Forums

This topic is locked

how to insert date use dropdown list??

Posted 06 Feb 2002 12:26:55
1
has voted
06 Feb 2002 12:26:55 yoghurt ng posted:
i want to insert member birthday to db
i use the month/day/year dropdown list to do it
but how can i insert to db in "birthday" field?
like mm/dd/yyyy
i had try the vbsript to do it but when i use that
the check form function will can't work normal
please help ! thx a lot

Replies

Replied 06 Feb 2002 15:19:15
06 Feb 2002 15:19:15 Mark Labordus replied:
I use three comboboxes to collect the birthdate from a user. Then I fill a hidden-field with the values from these comboboxes, like..

document.forms("formname".item("hideBirthDate".value = document.forms("formname".item("Month".value & "/" & document.forms("formname".item("Day".value & "/" & document.forms("formname".item("Year".value

Replied 06 Feb 2002 16:41:03
06 Feb 2002 16:41:03 Viktor Farcic replied:
Why don't you use three DB fields for birth date? Like: BirthMonth, BirthDay, BirthYear.

<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
i want to insert member birthday to db
i use the month/day/year dropdown list to do it
but how can i insert to db in "birthday" field?
like mm/dd/yyyy
i had try the vbsript to do it but when i use that
the check form function will can't work normal
please help ! thx a lot


<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Viktor Farcic

TalkZone Manager
Replied 08 Feb 2002 11:31:34
08 Feb 2002 11:31:34 Mark Labordus replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Why don't you use three DB fields for birth date? Like: BirthMonth, BirthDay, BirthYear.
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Just because I'm interested..
Why would you use 3 DB-fields?
It's maybe easier to fill the fields but I wonder if there are more advantages..

Mark.

Replied 28 Aug 2002 12:48:02
28 Aug 2002 12:48:02 Stephen Davidson replied:
Hi Guys,

I too am trying to insert a DATE into SQl and having problems. I tried taking the 3 drop down value into 1 hidden field using the following code.

&lt;input name="HFStartDate" type="hidden" id="HFStartDate" value="&lt;%=Request.Form("day"%&gt;/&lt;%=Request.Form("month"%&gt;/&lt;%=Request.Form("year"%&gt;"&gt;

But it does not work! any ideas as to what I am doing wrong??

Cheers,

SMD
Replied 14 Oct 2002 11:06:09
14 Oct 2002 11:06:09 George Petrov replied:
Guys,

What I usually do is the following:

1. Have 3 form entry or dropdown fields for the 3 date parts - day, month and year

2. have also an extra hidden field, called "fulldate" that will contain the full date

3. make a javascript function that reads the values of the 3 date fields - put a new string together like 10-18-2002 and saves it in the fulldate hidden field

4. make the js function be called onLoad of the page and also on each of the 3 date fields onChange

5. Save in your database the field fullDate

thants it - maybe I should make extension out of this some day.

George

-----------------------------------------------
George Petrov - Co-Founder, www.UDzone.com
The site for Macromedia
Dreamweaver UltraDev Developers!
-----------------------------------------------
Replied 15 Oct 2002 00:29:40
15 Oct 2002 00:29:40 James Threadgill replied:
If you use three fields then it is difficult to use the date for time determined queries. An example would be "Select date from table where date &gt;= (Date() - 30)" where you wanted records dated within the past 30 days.

<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Quote
Why don't you use three DB fields for birth date? Like: BirthMonth, BirthDay, BirthYear.
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Edited by - on 15 Oct 2002 00:30:15
Replied 15 Nov 2002 03:35:40
15 Nov 2002 03:35:40 Dennis van Galen replied:
yes well, you can always use date and time part functions to rebuild the date, if you prefer such a interface...
how else do you expect to build a birthday list that won't list on how old people are, but on calendar schedule ? Where would we be without datepart ?
you can always run a sp_build_temp_date or whatever and process your date...

With kind regards,

Dennis van Galen
Webmaster KPN Services
Financial and Information Services

Reply to this topic